<?php
$this->title = $model->name."航线销售详情";
?>

<?= yii\web\View::registerCssFile("/css/front/sale-detail.css",['depends' => 'app\assets\MuiAsset']) ?>

<div class="header container-fluid">
		<div class="header-l">
			<img src="<?=\Yii::$app->params['qiniu_path'].$model->image->path.'?imageView2/1/w/480/h/480'?>"  />
		</div>
		<div class="header-r">
			<h4><?=$model->name?></h4>
			<span><?=$model->go_time?>起航</span><span>剩余<em><?=round((strtotime($model->go_time)-time())/3600/24)?></em>天</span>
		</div>
	</div>
	<div class="header-info container-fluid">
		<div class="header-info-top">
			<div class="header-info-l">
				<i class="iconfont" >&#xe686;</i>
			</div>
			<div class="header-info-r">
					
					
					
				
				 <?php if($model->stock == 1){
							$num = $model->statusOrderRoom;
                    		echo sprintf("<p><span>舱房：</span><span>总数：<em>%s</em></span><span>剩余：<em>%s</em></span></p><p style='margin-left:57px'><span>提交：<em>%s</em></span><span>付款：<em>%s</em></span><span>付定金：<em>%s</em></span><span>占位：<em>%s</em></span></p>",$model->stockAll,$num[100],$num[4],$num[3],$num[2],$num[1]);
						  }else{
							$num = $model->statusOrderRoom;
							echo sprintf("<p><span>舱房：</span><span>总数：<em>%s</em></span><span>剩余：<em>%s</em></span></p><p style='margin-left:57px'><span>提交：<em>%s</em></span><span>付款：<em>%s</em></span><span>付定金：<em>%s</em></span><span>占位：<em>%s</em></span></p>",$model->stockAll2,$num[100],$num[4],$num[3],$num[2],$num[1]);	
				} ?>

				<?php $order_num = $model->statusOrderNum?>
				<p><span>订单：</span><span>总数：<em><?=$order_num[100]?></em></span><span>提交：<em><?=$order_num[4]?></em></span><span>付款：<em><?=$order_num[3]?></em></span><span>付定金：<em><?=$order_num[2]?></em></span><span>占位：<em><?=$order_num[1]?></em></span></p>
			</div>
		</div>
		<div class="header-info-bottom">
			<span>总金额：<em class="money">￥<?=floor($model->allOrderPrice)?></em></span>
		</div>
	</div>

	<div class="cf-num">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-collapse mui-active">
				<a class="mui-navigate-right" href="#">舱房剩余情况</a>
				<div class="mui-collapse-content cf-info">
					<table class="cf-tab" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<th width="40%">名称</th>
							<th width="30%">剩余/总数</th>
							<th width="30%">当前价格</th>
						</tr>
		<?php if($model->stock == 1) {?>
		<?php $show = 0; ?>
		<?php foreach($model->stockDetail as $key=>$val){ ?> <!-- val ProductRoom-->

			<?php if($val->show>0){ ?>
			<tr>
				<td><?= $val->room->name ?>  <?= $val->room->code ?> <?= $val->people ?>人间</td>
				<td>
					<?= ($val->num - $val->stockNum) ?> / <?= empty($val->num) ? 0 : $val->num ?> 
					
				</td>
				
				<td> <?= floor($val->price)?> / <?= floor($val->inside_price)?></td>
			</tr>
			<?php } ?>
		<?php } ?>
		
		<?php }elseif($model->stock == 2){ ?>

		<?php 
			if(isset($model->stockDetail ) && $model->stockDetail ){
			foreach($model->stockDetail as $key=>$val){ ?>
			<tr>
				<td><?= $val['name'] ?></td>
				<td> 
					<?php print_r($val['num']-$model->getSellStockRoom($key)) ?> / <?= $val['num'] ?> 
				</td>
				
				<td>
					<?= floor($val['price']) ?> / <?= floor($val['inside_price']) ?>
				</td>
			</tr>
		<?php } } ?>
		<?php } ?>
					</table>
				</div>
			</li>
		</ul>
	</div>
	<div class="cf-num">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-collapse mui-active">
				<a class="mui-navigate-right" href="#">订单销售情况</a>
				<div class="mui-collapse-content cf-info">
					<table class="cf-tab" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<th>销售</th>
							<th>数量</th>
							<th>金额</th>
						</tr>
						<?php if(!empty($model->sellOrderNum)){ ?>
							<?php foreach($model->sellOrderNum as $v){ ?>	
						<tr>
							<td><?=$v['name']?></td>
							<td><?=$v['num']?>单</td>
							<td class="money">￥<?=floor($v['price'])?></td>
						</tr>
							<?php };?>
						<?php };?>	
						
					</table>
				</div>
			</li>
		</ul>
	</div>

